Ammonia is removed from municipal wastewater using aeration, which is costly. Four different cascade control aeration configurations are compared to identify the most stable (i.e., least variable) operating condition–this will assist wastewater treatment plant operators in maintaining a low concentration of ammonia in the treated water. However, to improve accuracy and reduce mechanical wear of aeration systems the time lag associated with feedback control needs to be reduced. By forecasting the response variable, ammonia in the aeration basin, to account for the lag, it is hypothesized that the aeration control will improve. The advantages of forecasting using statistical and machine learning models is (a) no additional sampling, microbiological analysis, or proprietary software is requried to build the model and (b) the forecast can easily replace the current measured value of ammonia in the supervisory control and data aquisition (SCADA) system of the wastewater treatment facility–which lacks advanced control schema. The manuscript is organized as follows: (1) an introduction to control systems in wastewater treatment facilities, (2) summary of methods for quantifying variation in multivariate systems, (3) summary of staistical and machine learning methods used to build the ammonia forecasting models, and (4) an assessment of how forecasting models can improve conventional control in wastewater treatment.
Wastewater treatment facilities are similar to other industrial processes in that select monitored system parameters need to be within a set range for the system to operate properly. Unlike many industrial processes, municipal wastewater facilities have little control over the quantity and quality of the inputs to their system but are required by law to maintain a certain quality of the output. Due to the wide variation, manual adjustments of an open-loop control system (i.e., constant control output regardless of system conditions) cannot constantly achieve the level of treatment needed; frequently under-treating during peak flows and potentially exceeding regulated quality limits, and over-treating during low flows which wastes energy and other material inputs. Therefore, a flexible and responsive control system is required to maintain effluent water quality while minimizing energy and chemical input.
Feedback control determines a control action from a process measurement within the system (i.e., closed-loop control), and is able to automatically respond to system disturbances. The Proprotional-Integral-Derivative (PID) controller is the most common feedback controller in industrial automation due to it’s simplisity and robustness to respond to a deviation from desired conditions (i.e., error \(e(t)\)). A PID control action is the sum of: a proportional term (\(K_p(e(t))\)) where \(K_p\) is a constant value; a integral term (\(K_i \int_{0}^{t} e(\tau) d\tau\)) and incorporates past control error with the integral function; and a derivative term (\(K_d \frac{de(t)}{dt}\)) which anticipates future error with the derivative function. In the wastewater treatment industry, the derivative term is frequently set to 0 (i.e., PI control) due to the amplification of noise in the measured variable(Visioli 2006).
However, in controller design, actuator and sensor dynamics and wear-and-tear are frequently ignored (Visioli 2006). To maintain the form of the PID controller, which is the accepted control scheme at the majority of municipal wastewater treatment facilities worldwide, ac
25 MGD design, 12 MGD average, Daily ammonia limits as low as 1.9 mg/L High DO operation is trusted control strategy Carbon addition for N removal Monthly acetic acid consumption > 6,000 gal
SCADA has multiple aeration control modes Airflow Dissolved oxygen (DO) Ammonia-based aeration control (ABAC)
Figure 1. Flow, zone, and sensor diagram of one of the activated sludge aeration basins at the Boulder Water Resource Reclaimation Facility.
To train and test the forecasting model, the data must be aligned to simulate real-time prediction. For a dataset with n rows, observations \(1-(n-\Delta n\)) of all monitored process variables (\(X_1,X_2,..,X_p\)) will be merged with (\(\Delta n+1)-n\) observations of the forecasted variable to create a matrix with \(p+1\) columns and \(n-\Delta n\) rows.
The purpose of incorporating a diurnal component into a forecasting model is to capture the time-dependent component of the response variable, in this case ammonia. While the daily trend of ammonia loading to a wastewater facility is acknowledged, it is rarely modeled (Figure 1). The predictors in a diurnal model are various degrees (n) of sine and cosine functions where t is the minute of the day from 0 - 2\(\pi\), and \(\beta_i\) are fitted linear model parameters: \[\hat{y}_t = \beta_0 + \beta_1 sin(t) + \beta_2 cos(t) + \beta_3 sin(2 \cdot t) + \beta_4 cos(2 \cdot t) + ... + \beta_{2n-1} sin(n \cdot t) + \beta_{2n} cos(n \cdot t)\]
Figure 2: Timeseries plot of influent ammonia at the Boulder Water Resource Recovery Facility
In a standard linear model, a response (\(Y\)) is described using a set of predictor variables (\(X_1,X_2,..,X_p\)) and their corresponding model parameters \(\beta_0, \beta_1, ...,\beta_p\) where \(\epsilon\) is an error term: \[Y=\beta_0+\beta_1X_1+...+\beta_pX_p+\epsilon\] Typical linear models are fit using oridinary least squares, but prediction accuracy and model interpretabililty can be improved using alterntive fitting procedures (James et al. 2013).
Lasso is able to select model predictors (inputs). Ridge regression attempts to minimize the error of predictors while simultaneously eliminating insignificant predictors. The ‘shrinkage’ term responsible for driving the coefficients of insigificant predictors to zero is controled by \(\lambda\). When \(\lambda=0\), ridge regression returns the same linear model coefficients as the more well-known ordinary least squares model. Cross-validation
Adaptive lasso
The initial diurnal model fit used a single sine/cosine pair. However, this approach did not capture all visible cyclic patterns. Further testing evaluated the model fit of 1 - 200 sine/cosine pairs. The best diurnal model fit for the training and testing data of each control congiuration was effectively achieved using a 6 degree diurnal model (Figure 2). The realively low R2 value of the ABAC 3.5 control configuration is evident of abnormal variation in the minimum and maximum ammonia values (Figure 3).
Figure 3: Diurnal model fit as function of degree for each control configuration. The red line indicates the R2 (top) or RMSE (bottom) value for a 10th degree diurnal model, which is effectively achieved by a 6 degree or fewer diurnal model.
Figure 4: Timeseries plot of zone 7 ammonia at the Boulder Water Resource Recovery Facility
The remaining variation is modeled using a multiple linear regression model.
How the model is configured substancially impacts the forecast accuracy. When the diurnal model fit is separated from the linear model fit, the model does not account for weekly variation. When the sine and cosine terms are included in the linear model fit, the model is able to more accuratly capture process variation.
James, Gareth, Daniela Witten, Trevor Hastie, and Robert Tibshirani. 2013. An Introduction to Statistical Learning. Vol. 112. Springer.
Visioli, Antonio. 2006. Practical Pid Control. Springer Science & Business Media.